<?php

// phpMyRealty 3
//
// File Name: gallery.php
// File Location : ./
//
// Copyright (c)2009 phpMyRealty.com
//
// e-mail: support@phpMyRealty.com

// Include configuration file and general functions
define('PMR', 'true');

include ( './config.php' );
include ( PATH . '/defaults.php' );

// ----------------------------------------------------------------------
// USER CONTROL PANEL SECTION
// EDIT LISTING PHOTO GALLERY

// Check if the $_GET['id'] variable exist and it is a number
if (isset($_GET['id']) && eregi('^[0-9]+$', $_GET['id']))
 {

  // Fetching the listing data for title 
  $sql = 'SELECT title FROM ' . PROPERTIES_TABLE . ' WHERE id = ' . intval($_GET['id']) . ' LIMIT 1';
  $r_title = $db->query( $sql );
  $f_title = $db->fetcharray( $r_title );

 }

// Title tag content
$title = $conf['website_name_short'] . ' - ' . $lang['Edit_Listings'] . ' - ' . $f_title['title'] . ' - ' . $lang['Photo_Gallery']; 

// Template header
include ( PATH . '/templates/' . $cookie_template . '/header.php' );

// Authenticate user

// Check if the $_GET['id'] variable exist and it is a number
if (isset($_GET['id']) && eregi('^[0-9]+$', $_GET['id']))
 {

  // If logged we can start the page output
  if (auth_check($session->fetch('login'), $session->fetch('password')))
   {
    // Fetching the user data 
    $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE login = "' . $session->fetch('login') . '" LIMIT 1';
    $res = $db->query( $sql ) or error ('Critical Error', mysql_error());
    $f_res = $db->fetcharray( $res );

    // Fetching the listing data 
    $sql = 'SELECT * FROM ' . PROPERTIES_TABLE . ' WHERE id = "' . safehtml($_GET['id']) . '" LIMIT 1';
    $r = $db->query( $sql ) or error ('Critical Error', mysql_error());
    $f = $db->fetcharray( $r );

    // If this listing does not belong to this user we exit
    if ($f_res['id'] != $f['userid']) 
     error ('Critial Error', 'This listing does not belong to you.');

    // If the Submit button was pressed we start this routine

    // If user submitted a new gallery information or updated an
    // old one we add it or update the old record in the database
    if (((isset($_POST['submit_gallery']) 
    && $_POST['submit_gallery'] == $lang['Photo_Gallery_Submit'])))
     {

      // Initially we think that no errors were found
      $count_error = 0;

      // If no errors were found during the above checks we continue
      if ($count_error == '0')
       {
        // Update user details in the database

        // Get the user IP address
        $user_ip = $_SERVER['REMOTE_ADDR'];
        // If there is more than one IP
        // get the first one from the 
        // comma separated list
        if ( strstr($user_ip, ', ') ) 
         {
          $ips = explode(', ', $user_ip);
          $user_ip = $ips[0];
         }

        // If the gallery details were submitted
        // we generate the INSERT query
        if (isset($_POST['submit_gallery']) 
        && $_POST['submit_gallery'] == $lang['Photo_Gallery_Submit'])

{

// 1
if (isset($_FILES['image_file1']['tmp_name']) && $_FILES['image_file1']['tmp_name'] != '')
{

    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded1 = TRUE;

      if (isset($_POST['id']))
       $id = $_POST['id'];
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file1']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded1 = FALSE;

      if ($uploaded1 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded1 = FALSE;

}

// 2
if (isset($_FILES['image_file2']['tmp_name']) && $_FILES['image_file2']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded2 = TRUE;

      if (isset($_POST['id']))
       $id = $_POST['id'];
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file2']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded2 = FALSE;

      if ($uploaded2 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded2 = FALSE;

}

// 3
if (isset($_FILES['image_file3']['tmp_name']) && $_FILES['image_file3']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded3 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file3']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded3 = FALSE;

      if ($uploaded3 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded3 = FALSE;

}

// 4
if (isset($_FILES['image_file4']['tmp_name']) && $_FILES['image_file4']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded4 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file4']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded4 = FALSE;

      if ($uploaded4 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');

    }

   else

    $uploaded4 = FALSE;
}

// 5
if (isset($_FILES['image_file5']['tmp_name']) && $_FILES['image_file5']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded5 = TRUE;

      if (isset($_POST['id']))
       $id = $_POST['id'];
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file5']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded5 = FALSE;

      if ($uploaded5 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded5 = FALSE;

}

// 6
if (isset($_FILES['image_file6']['tmp_name']) && $_FILES['image_file6']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded6 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file6']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded6 = FALSE;

      if ($uploaded6 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded6 = FALSE;

}

// 7
if (isset($_FILES['image_file7']['tmp_name']) && $_FILES['image_file7']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded7 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file7']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded7 = FALSE;

      if ($uploaded7 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');

    }

   else

    $uploaded7 = FALSE;
}

// 8
if (isset($_FILES['image_file8']['tmp_name']) && $_FILES['image_file8']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded8 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file8']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded8 = FALSE;

      if ($uploaded8 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded8 = FALSE;

}

// 9
if (isset($_FILES['image_file9']['tmp_name']) && $_FILES['image_file9']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded9 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file9']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded9 = FALSE;

      if ($uploaded9 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded9 = FALSE;

}

// 10
if (isset($_FILES['image_file10']['tmp_name']) && $_FILES['image_file10']['tmp_name'] != '')
{
    if ($f_res['package'] != '' && $f_res['package'] != '0')
     {
      // Fetch Packages
      $sql = 'SELECT * FROM ' . PACKAGES_AGENT_TABLE  . ' WHERE id = ' . $f_res['package'] . ' LIMIT 1';
      $r_package = $db->query ( $sql );
      $f_package = $db->fetcharray ( $r_package );
     }
    else
     {
      $f_package['gallery'] = $conf['free_gallery'];
     }

    $sql = 'SELECT * FROM ' . GALLERY_TABLE . ' WHERE listingid = ' . $f['id'];
    $r = $db->query($sql) or error ('Critical Error', mysql_error () );

    if ($db->numrows($r) < $f_package['gallery'])
     {
         // Create a mysql query
         $sql = 'INSERT INTO '. GALLERY_TABLE .
         ' (userid, listingid, title, description, date_added, ip_added) 
  	 VALUES
	 ("' . $f_res['id'] . '", "' . $f['id'] . '", "property photo",
	  "", "' . date('Y-m-d') . '",
	  "' . $user_ip . '")';

	$db->query($sql) or error ('Critical Error', mysql_error ());

      // We think that the image is uploaded or will
      // return FALSE if the upload_image function
      // will fail
      $uploaded10 = TRUE;

      if (isset($_POST['id']))
       $id = safehtml($_POST['id']);
      else
       $id = mysql_insert_id();

      // Upload and resize the image
      upload_image ( 'gallery', $id, $_FILES['image_file10']['tmp_name'], $conf['gallery_resampled_width'] ) or $uploaded10 = FALSE;

      if ($uploaded10 == FALSE) $db->query( 'DELETE FROM '. GALLERY_TABLE . ' WHERE id = ' . $id . '');
    }

   else

    $uploaded10 = FALSE;

}


       }

     }

}
    // Navigation Menu
    echo table_header ( $lang['Menu_User_Login'] );

    echo ' <table cellpadding="5" cellspacing="0" border="0"> <tr>';

    echo '<td width="80" align="center" valign="top"><a href="' . URL . '/edituserlistings.php?id=' . intval($_GET['id']) . '"><img src="' . URL . '/templates/' . $cookie_template . '/images/icons/back.png" valign="top" border="0"><br />' . $lang['Back'] . '</a></td>';

    echo '<td width="80" align="center" valign="top"><a href="' . URL . '/login.php"><img src="' . URL . '/templates/' . $cookie_template . '/images/icons/login.png" valign="top" border="0"><br />' . $lang['Menu_User_Login'] . '</a></td>';
    echo ' </tr></table> ';

    echo table_footer();

    // Main form

    echo '<form action = "' . URL . '/gallery.php?id=' . intval($_GET['id']) . '" method="POST" enctype="multipart/form-data">';

    // Gallery Details Form

    echo table_header ( $lang['Photo_Gallery_Submit'] );

 

    if (isset($uploaded1) && $uploaded1)
     echo '<p align="center"><span class="warning">IMAGE 1, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded1) && !$uploaded1)
     echo '<p align="center"><span class="warning">IMAGE 1' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded2) && $uploaded2)
     echo '<p align="center"><span class="warning">IMAGE 2, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded2) && !$uploaded2)
     echo '<p align="center"><span class="warning">IMAGE 2' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded3) && $uploaded3)
     echo '<p align="center"><span class="warning">IMAGE 3, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded3) && !$uploaded3)
     echo '<p align="center"><span class="warning">IMAGE 3' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded4) && $uploaded4)
     echo '<p align="center"><span class="warning">IMAGE 4, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded4) && !$uploaded4)
     echo '<p align="center"><span class="warning">IMAGE 4' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';
                       
    if (isset($uploaded5) && $uploaded5)
     echo '<p align="center"><span class="warning">IMAGE 5, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded5) && !$uploaded5)
     echo '<p align="center"><span class="warning">IMAGE 5' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded6) && $uploaded6)
     echo '<p align="center"><span class="warning">IMAGE 6, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded6) && !$uploaded6)
     echo '<p align="center"><span class="warning">IMAGE 6' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded7) && $uploaded7)
     echo '<p align="center"><span class="warning">IMAGE 7, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded7) && !$uploaded7)
     echo '<p align="center"><span class="warning">IMAGE 7' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded8) && $uploaded8)
     echo '<p align="center"><span class="warning">IMAGE 8, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded8) && !$uploaded8)
     echo '<p align="center"><span class="warning">IMAGE 8' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded9) && $uploaded9)
     echo '<p align="center"><span class="warning">IMAGE 9, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded9) && !$uploaded9)
     echo '<p align="center"><span class="warning">IMAGE 9' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    if (isset($uploaded10) && $uploaded10)
     echo '<p align="center"><span class="warning">IMAGE 10, ' . $lang['Listing_Image_Uploaded'] . '</span></p>';
    if (isset($uploaded10) && !$uploaded10)
     echo '<p align="center"><span class="warning">IMAGE 10' . $lang['Listing_Image_NOT_Uploaded'] . '</span></p>';

    // Output the form
    echo '
     <table width="100%" cellpadding="5" cellspacing="0" border="0">
         ';

    echo userform ($lang['Listing_Image_File'] . ' 1', '<input type="file" size="40" name="image_file1" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 2', '<input type="file" size="40" name="image_file2" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 3', '<input type="file" size="40" name="image_file3" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 4', '<input type="file" size="40" name="image_file4" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 5', '<input type="file" size="40" name="image_file5" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 6', '<input type="file" size="40" name="image_file6" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 7', '<input type="file" size="40" name="image_file7" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 8', '<input type="file" size="40" name="image_file8" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 9', '<input type="file" size="40" name="image_file9" maxlength="50">');
    echo userform ($lang['Listing_Image_File'] . ' 10', '<input type="file" size="40" name="image_file10" maxlength="50">');
    echo userform ('', '<input type="Submit" name="submit_gallery" value="' . $lang['Photo_Gallery_Submit'] . '">');

    echo '
     </table>
         ';

    echo table_footer ();

    // Upload image form

    // Output the form


    echo '
    </form>
         ';

   }

  else

   error ('Critical Error' , 'Please, login to access this script.');

 }

else

 echo 'Sorry, ID is not specified';

// Template footer
include ( PATH . '/templates/' . $cookie_template . '/footer.php' );

?>